<?php
/**
 * Created by PhpStorm.
 * User: Jason
 * Date: 2017/8/12
 * Time: 15:24
 */

namespace Admin\Service;


class ScoreFavoriteService
{
    /**
     * 获取谱单收藏数量
     */
    public function multiFavCount($scoreIds)
    {
        $map = array(
            'score_id' => array('in', $scoreIds),
            'is_delete' => 0
        );
        $model = M('ScoreFavorite');
        $res = $model->field('score_id, count(*)')->where($map)->group('score_id')->select();
        $favCountMap = array();
        foreach ($res as $key => $val) {
            $favCountMap[$val['score_id']] = $val['count(*)'];
        }
        return $favCountMap;
    }
}